<form  name="form_admin" method="POST" action="<?php echo formEditAction()?>" onsubmit="return checkform(this);" >
<input type="hidden" name="id"  value="<?php echo $id?>" />
<input type="hidden" name="ParentId" value="<?php echo $tab['iParentId']?>" />
<textarea style="display: none;"></textarea>
<?php
if($act=="addtab")
{
?>
<table width="100%" cellpadding="0" cellspacing="0" id="tbledit">
    <tr>
        <td><span class="style1"><?php echo _NAME?></span></td>
        <td><input type="text" name="Name" id="Name" class="normal3" value="<?php echo $tab['cName']?>"/>
    </td>
    </tr>
    <tr>
        <td><b><?php echo Type?></b></td>
        <td>
            <select name="Type">
                <option value="Image">Image</option>
                <option value="Video">Video</option>
                <option value="Text">Text</option>
            </select>
            &nbsp;&nbsp;
            <b>Status</b>
            <select name="Status">
                <?php echo liststatus($tab['iStatus'])?>
            </select>

        </td>
    </tr>
</table>

<?php
}else //act==edittab
{
?>
<table width="100%" cellpadding="0" cellspacing="0" >
    <tr>
        <td width="150"><span class="style1"><?php echo _NAME?></span></td>
        <td><input type="text" name="Name" id="Name" class="normal3" value="<?php echo $tab['cName']?>"/>
    </td>
    </tr>
    <tr>
        <td><b>Status</b></td>
        <td>
            <select name="Status">
                <?php echo liststatus($tab['iStatus'])?>
            </select>

        </td>
    </tr>
</table>
<br />
    <?php
    if($tab['cType']=="Image")
    {
    ?>
        <table width="100%" cellpadding="4" cellspacing="1"id="tblsort">
            <tr class="headtb" nodrop="true" nodrag="true">
        		<td width="5" ><?php echo _IMAGE?></td>
        		<td width="300" ><?php echo _NAME?></td>
        		<td width="20" ><?php echo _ACTIONS?></td>
        		<td></td>
        	</tr>
        </table>
        <input type="button" class="b1" onclick="tinyMCE.execCommand('mceTrImgC',{func:addrow})" value="Select Images">
        <input type="button" onclick="location.reload(true)" class="b1" id="breset"  value="<?php echo _RESET?>">
        <script>
        var orderrow=0;
        var addrow=function (obj)
        {
            if(obj.id==undefined)obj.id=-1;
        	tblroot=getId("tblsort").tBodies[0];
        	var newtr=document.createElement("tr");
        	newtr.className='row_'+(orderrow%2);
        	var newtd=document.createElement("td");
        	newtd.innerHTML="<img src='"+obj.r+obj.p+obj.f+"' width=30 height=30>";
        	newtr.appendChild(newtd);

        	var newtd=document.createElement("td");
        	var inputlname=document.createElement("input");
            var inputlid=document.createElement("input");
        	inputlname.className="edit";
        	inputlname.name="ListName[]";
            inputlname.value=obj.f;
            if(obj.n!=undefined)
            {
                inputlname.value=obj.n;
            };
        	inputlname.onclick = function(){ this.select();};
            inputlid.type="hidden";
            inputlid.name="ListId[]";
            inputlid.value=obj.id;
        	newtd.appendChild(inputlname);
            newtd.appendChild(inputlid);
        	var inputImg=document.createElement("input");
        	inputImg.type="hidden";
        	inputImg.name="ListUrl[]";
        	inputImg.value=obj.p+obj.f;
        	newtd.appendChild(inputImg);
        	newtr.appendChild(newtd);
        	var newtd=document.createElement("td");
        	var newa=document.createElement("a");
        	newa.innerHTML="delete";
        	newa.style.cursor="pointer";
        	newa.onclick=function()
        	{
        	   newtr.style.display='none';
               inputImg.value=-1;
        	};
        	newtd.appendChild(newa);
        	newtr.appendChild(newtd);

        	tblroot.appendChild(newtr);
        	orderrow++;
        };
        <?php
        foreach($listphotos as $i=>$content)
        {
            echo "addrow({id: ".$content['iId'].",n: '".$content['cName']."',r:'../".$folder_img_upload."',p:'',f:'".$content['cImage']."'});";
        }
        ?>
        </script>
    <?
    }else if($tab['cType']=="Video")
    {
    ?>
    <table width="100%" cellpadding="0" cellspacing="0" >
        <tr>
            <td width="150"><b>Code Video</b></td>
            <td>
            <textarea class="noeditor" name="Content"><?php echo $tab['cIntro']?></textarea>
            </td>
        </tr>
    </table>
    <?php
    }else
    {
    ?>
    <table width="100%" cellpadding="0" cellspacing="0" >
        <tr>
            <td width="150"><b>Text</b></td>
            <td>
            <textarea  name="Content"><?php echo $tab['cIntro']?></textarea>
            </td>
        </tr>
    </table>
    <?php
    }//end if type
}//end if $act=="addtab"
?>
</form>
<script>
function checkform(f)
{
    if(f.Name.value=="")
    {
        alert("Please enter name tab");
        f.Name.focus();
        return false;

    return true;
    }
}
</script>